{% set pypi_name = 'sphinx-feature-classification' %}
{% set upstream_version = upstream_version('1.1.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Epoch:          {{ epoch('sphinx-feature-classification') }}
Summary:        OpenStack sphinx-feature-classification library
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/sphinx-feature-classification/latest/
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('ddt') }}
BuildRequires:  {{ py3('devel') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('testrepository') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
This is a Sphinx directive that allows creating matrices of drivers
a project contains and which features they support.

%package -n {{ py2name(py_versions='py3') }}
Summary:        OpenStack sphinx-feature-classification library
Requires:       {{ py3('docutils') }}
Requires:       {{ py3('pbr') }}

%description -n {{ py2name(py_versions='py3') }}
This is a Sphinx directive that allows creating matrices of drivers
a project contains and which features they support.

%package -n python-sphinx-feature-classification-doc
Summary:       Documentation for the OpenStack sphinx-feature-classification library
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}

%description -n python-sphinx-feature-classification-doc
Documentation for the OpenStack sphinx-feature-classification library.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup

%build
%{py3_build}

PYTHONPATH=. %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

%check
PYTHON=python3 python3 setup.py test

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%{python3_sitelib}/sphinx_feature_classification
%{python3_sitelib}/*.egg-info

%files -n python-sphinx-feature-classification-doc
%doc doc/build/html README.rst
%license LICENSE

%changelog
